<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>进药信息界面</title>
    <link rel="stylesheet" href="../css/stock.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/stock.js"></script>
</head>
<body>
<!-- 按钮 新增+查询 -->
<div id="flex">
    <button id="stock-add">新增信息</button>
    <!--//输入药品查询方式-->
    <div id="selectNameInput">
        <label for="nameInput">药品名称</label>
        <input type="text" id="nameInput" placeholder="请输入药品名称">
        <button class="stock-select-btn" id="stockNameSelectBtn">点击查询</button>
    </div>
    <!--//输入供应商查询方式-->
    <div id="selectSuiInput">
        <label for="suiInput">供应商名称</label>
        <input type="text" id="suiInput" placeholder="请输入供应商名称">
        <button class="stock-select-btn" id="stockSuiSelectBtn">点击查询</button>
    </div>
    <!--//输入日期查询方式-->
    <div id="selectDateInput">
        <label for="dateInput">订单日期</label>
        <input type="date" id="dateInput" placeholder="请选择订单日期">
        <button class="stock-select-btn" id="stockDateSelectBtn">点击查询</button>
    </div>
</div>
<!--//显示查询信息-->
<hr/>
<div class="stock-table">
    <table id="tb_2" cellspacing="0" cellpadding="2" width="100%" border="1">
        <!--<tbody>-->
        <tr align="center" bgcolor="#dcdcdc">
            <!--<td style="display: none">id</td>-->
            <td style="width:100px;">订单编号</td>
            <td>药品名称</td>
            <td>单位</td>
            <td>规格</td>
            <td>供应商</td>
            <td>进价</td>
            <td>数量</td>
            <td>总价</td>
            <td>订单日期</td>
            <td>有效期</td>
            <td>操作</td>
        </tr>
        <!--<tr>-->
            <!--<td>id</td>-->
            <!--<td style="width:100px;">201901041643</td>-->
            <!--<td>药品名称</td>-->
            <!--<td>单位</td>-->
            <!--<td>规格</td>-->
            <!--<td>河南省郑州市新郑市子欣制药有限公司</td>-->
            <!--<td>进价</td>-->
            <!--<td>数量</td>-->
            <!--<td>总价</td>-->
            <!--<td>订单日期</td>-->
            <!--<td>有效期</td>-->
            <!--<td>-->
                <!--<button>编辑</button>-->
                <!--<button>删除</button>-->
            <!--</td>-->
        <!--</tr>-->
        <!--</tbody>-->
    </table>
</div>

<!-- 新增信息界面 -->
<div class="stock-input">
    <div class="judge-div">
        <input type="text" class="addStock-input" id="mec-num" placeholder="请输入药品编号">
        <p class="judge" id="judgeNum"></p>
    </div>
    <div class="judge-div">
        <input type="text" class="addStock-input" id="mec-name" placeholder="请输入药品名称">
        <p class="judge" id="judgeName"></p>
    </div>
    <div class="judge-div">
        <input type="date" class="addStock-input" id="mec-time" placeholder="请填入进货日期">
        <p class="judge" id="judgeTime"></p>
    </div>
    <div class="judge-div">
        <input type="text" class="addStock-input" id="mec-price" placeholder="请输入药品进价">
        <p class="judge" id="judgePrice"></p>
    </div>
    <div class="judge-div">
        <select id="select2">
            <option value="">请填写药品保质期</option>
            <option value="3">三个月</option>
            <option value="6">六个月</option>
            <option value="12">一年</option>
            <option value="24">两年</option>
        </select>
        <p class="judge" id="judgeData"></p>
    </div>
    <div class="judge-div">
        <input type="text" class="addStock-input" id="mec-count" placeholder="请输入进药数量">
        <p class="judge" id="judgeCount"></p>
    </div>
    <div class="judge-div">
        <input type="text" class="addStock-input" id="mec-total" placeholder="填写药品总价">
        <button id="stock-get-total">获取总价</button>
        <p class="judge" id="judgeTotal"></p>
    </div>
    <div class="add-button">
        <button id="addStock-sure" type="submit">确认</button>
        <button id="addStock-back" type="submit">返回</button>
    </div>
</div>

<!-- 编辑弹窗界面 -->
<div class="all-stock-update-input">
    <div>
        <label for="stock-update-input-num">订单编号</label>
        <input class="stock-update-input" type="text" id="stock-update-input-num" value="" readonly="readonly">
    </div>
    <div><label for="stock-update-input-name">药品名称</label>
        <input class="stock-update-input" type="text" id="stock-update-input-name" value="" readonly="readonly">
    </div>
    <div><label for="stock-update-input-unit">单位</label>
        <input class="stock-update-input" type="text" id="stock-update-input-unit" value="" readonly="readonly">
    </div>
    <div><label for="stock-update-input-type">规格</label>
        <input class="stock-update-input" type="text" id="stock-update-input-type" value="" readonly="readonly">
    </div>
    <div><label for="stock-update-input-sui">生产商</label>
        <input class="stock-update-input" type="text" id="stock-update-input-sui" value="" readonly="readonly">
    </div>
    <div><label for="stock-update-input-price">售价</label>
        <input class="stock-update-input" type="text" id="stock-update-input-price" value="">
    </div>
    <div><label for="stock-update-input-count">数量</label>
        <input class="stock-update-input" type="number" id="stock-update-input-count" value="">
    </div>
    <div><label for="stock-update-input-price">总价</label>
        <input class="stock-update-input" type="text" id="stock-update-input-total" value="">
    </div>
    <div><label for="stock-update-input-data">日期</label>
        <input class="stock-update-input" type="text" id="stock-update-input-data" value="">
    </div>
    <div><label for="stock-update-input-useData">有效期</label>
        <input class="stock-update-input" type="text" id="stock-update-input-useData" value="">
    </div>
    <div class="stock-add-button">
        <button id="addStock-update-sure" type="submit">确认</button>
        <button id="addStock-update-back" type="submit">返回</button>
    </div>
</div>
<div id="over"></div>
<script type="text/javascript">
    var tTD; //用来存储当前更改宽度的Table Cell,避免快速移动鼠标的问题
    var table = document.getElementById("tb_2");
    for (j = 0; j < table.rows[0].cells.length; j++) {
        table.rows[0].cells[j].onmousedown = function () {
//记录单元格
            tTD = this;
            if (event.offsetX > tTD.offsetWidth - 10) {
                tTD.mouseDown = true;
                tTD.oldX = event.x;
                tTD.oldWidth = tTD.offsetWidth;
            }
//记录Table宽度
//table = tTD; while (table.tagName != ‘TABLE') table = table.parentElement;
//tTD.tableWidth = table.offsetWidth;
        };
        table.rows[0].cells[j].onmouseup = function () {
//结束宽度调整
            if (tTD == undefined) tTD = this;
            tTD.mouseDown = false;
            tTD.style.cursor = 'default';
        };
        table.rows[0].cells[j].onmousemove = function () {
//更改鼠标样式
            if (event.offsetX > this.offsetWidth - 10)
                this.style.cursor = 'col-resize';
            else
                this.style.cursor = 'default';
//取出暂存的Table Cell
            if (tTD == undefined) tTD = this;
//调整宽度
            if (tTD.mouseDown != null && tTD.mouseDown == true) {
                tTD.style.cursor = 'default';
                if (tTD.oldWidth + (event.x - tTD.oldX) > 0)
                    tTD.width = tTD.oldWidth + (event.x - tTD.oldX);
//调整列宽
                tTD.style.width = tTD.width;
                tTD.style.cursor = 'col-resize';
//调整该列中的每个Cell
                table = tTD;
                while (table.tagName != 'TABLE') table = table.parentElement;
                for (j = 0; j < table.rows.length; j++) {
                    table.rows[j].cells[tTD.cellIndex].width = tTD.width;
                }
//调整整个表
//table.width = tTD.tableWidth + (tTD.offsetWidth – tTD.oldWidth);
//table.style.width = table.width;
            }
        };
    }
</script>

</body>
</html>